<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
</head>

<body>
  <input type="text" value="00:00:00" />
  <input type="button" value="开始" />
  <input type="button" value="暂停" />
  <input type="button" value="重置" />
  <script>
    var oTxt = document.getElementsByTagName("input")[0];
    var oStart = document.getElementsByTagName("input")[1];
    var oStop = document.getElementsByTagName("input")[2];
    var oReset = document.getElementsByTagName("input")[3];
    var n = 0,
      timer = null;

    //开始计时
    oStart.onclick = function () {
      timer = setInterval(function () {
        n++;
        var m = parseInt(n / 6000);
        var s = parseInt(n / 100);
        var ms = parseInt(n % 100);
        oTxt.value = Tozero(m) + ":" + Tozero(s) + ":" + Tozero(ms);
      }, 10);
    };

    //暂停计时
    oStop.onclick = function () {
      clearInterval(timer);
    };

    //重置计时
    oReset.onclick = function () {
      oTxt.value = "00:00:00";
      n = 0;
    };

    function Tozero(n) {
      return n < 10 ? "0" + n : "" + n;
    }
  </script>
</body>

</html>